package com.ymatou.iapi.userservice.service;

import java.util.ArrayList;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.ymatou.iapi.userservice.parameter.req.BriefBatchUserRequestDtoReq;
import com.ymatou.iapi.userservice.parameter.resp.QueryBatchUserBriefNetResp;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*根据userid批量查询用户明细信息Call
*FreeMaker Template自动生成代码
*/
public class BatchUserDetailsRequestDtoCall extends YmatouBaseCall{
	private static String opurl ="json/reply/BatchUserRequestDto";
	
	public BatchUserDetailsRequestDtoCall() {
		super(EnvSetup.getSystemUrl("userservice_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	
	/**
	 * 获取Result
	 * 
	 * @return
	 */
	
	public ArrayList<QueryBatchUserBriefNetResp> getResult() {
		ArrayList<QueryBatchUserBriefNetResp> Result = new ArrayList<QueryBatchUserBriefNetResp>();
		try {
			String result = new JSONObject(getReturnData()).getString("Result");
			Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").disableHtmlEscaping().create();
			Result = (ArrayList<QueryBatchUserBriefNetResp>) gson.fromJson(result, new TypeToken<ArrayList<QueryBatchUserBriefNetResp>>() {
			}.getType());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Result;
	}
}